package com.java1902.grademanager;

import java.util.InputMismatchException;
import java.util.Scanner;

public class Utils {
	/**
	 * 返回整数，如果出错，允许重新输入
	 * @return
	 */
	public static int inputInt() {
		int number = 0;
		boolean isOk = true;
		while(isOk) {
			try {
				Scanner scanner = new Scanner(System.in);
				number = scanner.nextInt();
				isOk = false;
			}catch(InputMismatchException im) {
				System.out.println("输入出错,重新输入: ");
			}
			
		}
		return number;
		
	}
	
	/**
	 * 输入字符串
	 */
	public static String inputString() {
		Scanner scanner = new Scanner(System.in);
		return scanner.next();
	}
}
